package com.example.zhaohang.intentbudle;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

public class MainActivity extends AppCompatActivity {

    private String one = "one";
    private String two = "two";
    private String three = "three";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void one(View view) {
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putString("one",one);
        intent.setClass(MainActivity.this, OneActivity.class);
        intent.putExtras(bundle);
        startActivity(intent);
    }

    public void two(View view) {
        Intent intent = new Intent();
        Bundle bundle = new Bundle();
        bundle.putString("two",two);
        intent.setClass(MainActivity.this, OneActivity.class);
        intent.putExtras(bundle);
        startActivity(intent);
    }

    public void three(View view) {
        Intent intent = new Intent();
        intent.setClass(MainActivity.this, ThreeActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString("three",three);
        intent.putExtras(bundle);

        startActivity(intent);
    }
    /**
     * fragment中获取activity中的数据
     */
//    Bundle   arguments   = getArguments();
//    String   packageName = arguments.getString(Fields.SHOWACTIVITY.PACKAGENAME);
//    int      aa          =  arguments.getInt("aa");
//    TextView textView    = new TextView(getContext());
//        textView.setText("我的"+aa+"背包:"+packageName);
//        return textView;

    /**
     * 如果用Message传递的话，只能new一次message
     */

    //     viewHolder.mBigImageView.setOnClickListener(new View.OnClickListener()
//
//    {
//        @Override
//        public void onClick (View view){
//
//        Message message = new Message();
//        //可以接受Been对象等数据
//        Bundle bundle = new Bundle();
//        bundle.putString("signalPower", "这是第一个");
//        message.what = 1;
//        message.setData(bundle);
//        mHandler.sendMessage(message);
//
//    }
        //    });
        //        viewHolder.mOneImageView.setOnClickListener(new View.OnClickListener() {
        //        @Override
        //        public void onClick(View view) {
        //            //同 new Message();
        //            Message message = mHandler.obtainMessage();
        //
        //            //可以接受Been对象等数据
        //            Bundle bundle = new Bundle();
        //            bundle.putString("signalPower", "这是下面第一个");
        //            message.what = 1;
        //            message.setData(bundle);
        //            mHandler.sendMessage(message);
        //
        //        }
        //    });
        //        viewHolder.mTwoImageView.setOnClickListener(new View.OnClickListener() {
        //        @Override
        //        public void onClick(View view) {
        //
        //            //同 new Message();
        //            Message message = mHandler.obtainMessage();
        //            //可以接受Been对象等数据
        //            Bundle bundle = new Bundle();
        //            bundle.putString("signalPower", "这是下面第二个");
        //            message.what = 1;
        //            message.setData(bundle);
        //            mHandler.sendMessage(message);
        //
        //        }
        //    });

}
